<?php

declare (strict_types=1);

namespace App\Model;

use Hyperf\Database\Model\Relations\HasOne;

/**
 * @property int $id 文件ID
 * @property int $shop_id 店铺
 * @property int $fileinfo_id 对应的文件
 * @property int $cert_id 对应的认证信息ID
 * @property int $type 附件类型：1形象照片 2营业执照 3实名认证信息
 */
class FlyShopCertificateAtt extends CloudBase
{
    /**
     * @var bool
     */
    public $timestamps = false;

    /**
     * @var string
     */
//    protected $dateFormat = 'U';

    /**
     * The table associated with the model.
     *
     * @var string
     */
    protected $table = 'fly_shop_certificate_att';

    /**
     * The attributes that are mass assignable.
     *
     * @var array
     */
    protected $fillable = [];

    /**
     * The attributes that should be cast to native types.
     *
     * @var array
     */
    protected $casts = [
        'id' => 'integer',
        'shop_id' => 'string',
        'fileinfo_id' => 'string',
        'cert_id' => 'string',
        'type' => 'integer'
    ];


    /**
     * 获取文件
     * @return HasOne
     */
    public function with_fileinfo()
    {
        return $this->hasOne(Fileinfo::class, 'fileinfo_id', 'fileinfo_id');
    }
}